import { IRequestOption } from '@jl/common/composable';
import { request } from '@jl/common/utils';
import { IDeviceInfo, IModuleGetParam, IModuleInfo } from './types';

/**
 * 查询设备列表
 * @param requestOption
 * @returns
 */
export const getDeviceList = async (
  requestOption: IRequestOption<API.Base.RequestPageParam, any>
): Promise<API.Base.ResponsePage2<IDeviceInfo>> => {
  return request({
    url: '/iot-api/device/page',
    method: 'POST',
    ...requestOption,
  });
};

/**
 * 查询模块列表
 * @param requestOption
 * @returns
 */
export const getModuleList = async (
  requestOption: IRequestOption<any, IModuleGetParam>
): Promise<IModuleInfo[]> => {
  return request({
    url: `/iot-api/device/runtime`,
    method: 'GET',
    ...requestOption,
  });
};
